using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Lesson39 : MonoBehaviour
{
    public Transform Ikposition;

    private float z;

    private Vector3 mousepositon;
    // Start is called before the first frame update
    void Start()
    {
        z = Camera.main.WorldToScreenPoint(Ikposition.position).z;
    }

    // Update is called once per frame
    void Update()
    {
        mousepositon=Input.mousePosition;
        if (Input.GetMouseButton(0))
        {
            mousepositon.z = z;
            Ikposition.position = Camera.main.ScreenToWorldPoint(mousepositon);
        }
    }
}
